//
//  Utility.h
//  ErpApp2.0
//
//  Created by EricWei on 14-3-17.
//
//

#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonCryptor.h>
static NSString *_key = @"wxtwxtwx";
@interface Utility : NSObject
#pragma  mark - 判断字符串是否为空
//判断字符串是否为空
+(BOOL) isBlankString:(NSString *)string;
/**
 获取当前时间
 
 @return <#return value description#>
 */
+(NSString*)getCurrentTimes;
/**
 字符串转时间戳
 
 @param str <#str description#>
 @return <#return value description#>
 */
+(NSInteger)geTimestamp:(NSString *)str;
/**
 时间戳转换时间
 
 @param time <#time description#>
 @return <#return value description#>
 */
+ (NSString *)getAllTimeString:(NSInteger)time;
/**
 首页时间戳转换时间
 
 @param time <#time description#>
 @return <#return value description#>
 */
+ (NSString *)getIndexTimeString:(NSInteger)time;
/**
 时间戳转换时间
 
 @param time <#time description#>
 @return <#return value description#>
 */
+ (NSString *)getTimeString:(NSInteger)time;

#pragma  mark - 去除空格
//去除空格
+(NSString*)getString:(NSString *)string;

#pragma  mark - 隐藏uitableview多余的cell
//隐藏uitableview多余的cell
+(void)setExtraCellLineHidden: (UITableView *)tableView;

#pragma  mark - 处理空字符串
//处理空字符串
+(NSString *)doEmptyString:(NSString*)str;

#pragma  mark - 日期格式化
//日期格式化
+(NSString*)DateFromater:(NSDate*)current strDateFromater:(NSString *)str;

#pragma  mark - 设置返回按钮
////设置返回按钮
//+(void)setBackButton:(UIViewController*)uiviewcontroller navigationItem:(UINavigationItem *)navigationItem selector:(SEL)selector;

+(NSString*)GetStrByNull:(NSString*)str returnStr:(NSString*)returnStr;
//+(BOOL)isReachable:(UIView*)targetView;

#pragma mark - Md5加密

+(NSString *)md5:(NSString*)str;
+ (UIColor *)UIColorFromRGB: (NSInteger)rgbValue;
+ (BOOL)isPureInt:(NSString *)string;
/**
 @abstract  返回字符串的高度。
 @discussion <#statements#>
 @since <#statements#>
 */
+(CGSize)boundingRectWithSize:(CGSize)size strText:(NSString*)strText font:(UIFont*)font;
/**
 @abstract 得到当前时间。
 @discussion <#statements#>
 @since <#statements#>
 */
+(NSString *)getCurrentDate;
/** @abstract 转成String */
+(NSString*) idToString:(id)obj;

#pragma mark -  DES 加密、解密
/**@abstract DES 加密、解密*/
+ (NSString *) doCipher:(NSString *)sTextIn key:(NSString *)sKey context:(CCOperation)encryptOrDecrypt;
/**@abstract DES 加密*/
+ (NSString *) encryptStr:(NSString *) str;
/**@abstract DES 解密*/
+ (NSString *) decryptStr:(NSString *) str;
#pragma mark Based64
/**@abstract Base64 加密*/
+ (NSString *) encodeBase64WithString:(NSString *)strData;
/**@abstract Base64 加密*/
+ (NSString *) encodeBase64WithData:(NSData *)objData;
/**@abstract Base64 解密*/
+ (NSData *) decodeBase64WithString:(NSString *)strBase64;
#pragma mark - URL编码
/** @abstract URL编码 */
+ (NSString *)URLEncode:(NSString*)baseUrl data:(NSDictionary*)dictionary;
/** @abstract 字符串编码 */
+ (NSString *)StringEncode:(NSString*)str;
#pragma mark - 序列化参数字典（进行URL编码）
/** @abstract 序列化参数字典（进行URL编码） */
+(NSMutableDictionary*)ParamEncodeByDic:(NSMutableDictionary*)dictionary;

#pragma mark - 判断是否邮箱
/**
 @abstract 判断是否邮箱
 *
 *  @param email <#email description#>
 *
 *  @return <#return value description#>
 */
+ (BOOL)isValidateEmail:(NSString *)email;
#pragma mark - 正则获取url参数
/**
 @abstract 正则获取url参数。
 @discussion <#statements#>
 @since <#statements#>
 */
+(NSString *) getParamValue:(NSString *)CS webaddress:(NSString *)webaddress;


#pragma mark - 判断是否安装过某个APP
/**
 @abstract 判断是否安装过某个APP。
 @discussion <#statements#>
 @since <#statements#>
 */
+(BOOL)  APCheckIfAppInstalled2:(NSString *)urlSchemes ;

#pragma mark - 参数签名加密
//7 返回拼接字符串
+(NSMutableDictionary *)createTokenJoinByDic:(NSMutableDictionary *)dic;
#pragma mark - 通过字典获取Model
/**
 *  @author EricWei, 2016-03-31 14:03:33
 *  @abstract 通过字典获取Model
 *
 *  通过字典获取Model
 *
 *  @param dic <#dic description#>
 *
 *  @return <#return value description#>
 */
+(id)getModelFromDic:(NSDictionary*)dic Cls:(Class)cls;


+ (NSString *)URLEncodedString:(NSString *)url;
+ (UIColor *)colorWithHexString: (NSString *)color;
/**
 获取字符串的高度 s:string  f:font  w:width
 
 @param s <#s description#>
 @param f <#f description#>
 @param w <#w description#>
 @return <#return value description#>
 */
+ (CGFloat)String:(NSString *)s Font:(CGFloat)f Width:(CGFloat)w;
@end

